﻿#pragma once

#include <cstdint>

enum EShaderFrequency : uint8_t
{
    SF_Vertex				= 0,
    SF_Mesh					= 1,
    SF_Amplification		= 2,
    SF_Pixel				= 3,
    SF_Geometry				= 4,
    SF_Compute				= 5,
    SF_RayGen				= 6,
    SF_RayMiss				= 7,
    SF_RayHitGroup			= 8,
    SF_RayCallable			= 9,
    SF_WorkGraphRoot		= 10,
    SF_WorkGraphComputeNode	= 11,

    SF_NumFrequencies	= 12,

    // Number of standard shader frequencies for graphics pipeline (excluding compute)
    SF_NumGraphicsFrequencies = 5,

    // Number of standard shader frequencies (including compute)
    SF_NumStandardFrequencies = 6,

    SF_NumBits			= 4,
};
static_assert(SF_NumFrequencies <= (1 << SF_NumBits), "SF_NumFrequencies will not fit on SF_NumBits");

inline std::string ConvertShaderFrequency(EShaderFrequency Frequency, bool bSupportSM6)
{
    switch (Frequency)
    {
    case SF_Vertex:
        return bSupportSM6 ? "vs_6_0" : "vs_5_0";
    case SF_Mesh:
        {
            check(bSupportSM6);
            return "ms_6_5";
        }
    case SF_Amplification:
        {
            check(bSupportSM6);
            return "as_6_5";
        }
    case SF_Pixel:
        return bSupportSM6 ? "ps_6_0" : "ps_5_0";
    case SF_Geometry:
        {
            check(!bSupportSM6);
            return "gs_5_0";
        }
    case SF_Compute:
        return bSupportSM6 ? "cs_6_0" : "cs_5_0";
    default:
        {
            check(false);
            return "";
        }
    }
}
